import Cookies from 'js-cookie'
import { TokenType } from '@/utils/enum'

class Token {
  static set({ access_token, expires_in, refresh_token, refresh_token_expires_in }) {
    Cookies.set(TokenType.USER_TOKEN, access_token, { expires: new Date(expires_in) })
    Cookies.set(TokenType.USER_REFRESHTOKEN, refresh_token, { expires: new Date(refresh_token_expires_in) })
  }
  static remove() {
    Cookies.remove(TokenType.USER_TOKEN)
    Cookies.remove(TokenType.USER_REFRESHTOKEN)
  }
}

export default Token
